home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 17
/
CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso
/
CUCD
/
Programming
/
DiceSource
/
test
/
lib
/
stkjump.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-23
|
522b
|
46 lines
/*
* TEST/STKJUMP.C
*/
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
jmp_buf x;
extern long _stack_base;
myexit()
{
longjmp(x, 2);
}
main(ac, av)
char *av[];
{
int r;
onbreak(myexit);
if (r = setjmp(x)) {
Execute("avail", 0, 0);
printf("exit code %d\n", r);
exit(10);
}
Execute("avail", 0, 0);
subroutine(atoi(av[1]));
return(0);
}
subroutine(n)
{
char buf[256];
if (n == 0)
return;
printf("Base = %08lx\n", _stack_base);
subroutine(n - 1);
}